<?php

class NewsController extends Zend_Controller_Action{
	public function indexAction(){
		$news = new Application_Model_NewsMapper();
		$page =  $this->_getParam('page', 1);
		$paginator = Zend_Paginator::factory($news->fetchAll());
		$paginator	-> setItemCountPerPage(3)
					-> setCurrentPageNumber($page)
					-> setPageRange(5);
		$form = new Application_Form_Comment();
		if(Zend_Auth::getInstance()->hasIdentity()){
			$this->view->form = $form;
		}
		$this->view->entries = $paginator;
	}
}